Release 10.1A: OpenEdge Getting Started:
Object-oriented Programming


Progress session object references

The FIRST-OBJECT and LAST-OBJECT attributes on the SESSION system handle provide access to the list of currently instantiated objects. FIRST-OBJECT and LAST-OBJECT are both references to Progress.Lang.Object objects. Once you get the first object reference in the list using FIRST-OBJECT or the last object reference in the list using LAST-OBJECT, you can use the NEXT-SIBLING and PREV-SIBLING data members on Progress.Lang.Object to walk the list of currently instantiated objects.

Because these are object references to Progress.Lang.Object, if you need to use the object as its instantiated type (the type used in the NEW statement), you need to CAST the object to the required type. For more information on casting, see the "Assignment and the CAST function" section.

For example, you could display the list of all class type names currently instantiated in the Progress session with the following code:

DEFINE VARIABLE myObj AS CLASS Progress.Lang.Object NO-UNDO. 
myObj = SESSION:FIRST-OBJECT. 
REPEAT: 
    IF myObj EQ ? THEN 
        LEAVE. 
    MESSAGE myObj:GetClass( ):TypeName VIEW-AS ALERT-BOX. 
    myObj = myObj:NEXT-SIBLING. 
END. 


Copyright © 2005 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095